const express = require('express');
const cors = require("cors");
const dotenv = require('dotenv');
const mongoose = require("mongoose");

const recordRouter = require("./Router/recordRouter");

dotenv.config(); 
mongoose
  // .connect("mongodb://localhost:27017/wx")
  .connect(process.env.MONGO_CONFIG)
  .then(() => {
    console.log("DB Connetion Successfull");
  })
  .catch((err) => {
    console.log(err.message);
  });
const app = express();
app.use('/static',express.static('public'))
app.use(express.json());

app.use(
  cors({
    origin: "*",
    methods: ["GET", "POST"],
  })
);
app.use("/api", recordRouter);
app.listen(8888,()=>{
  console.log("node running at http://81.70.49.198:8888");
})
